package com.cyc.basic.test.rule;

import lombok.Getter;

/**
 * @author fei
 */

@Getter
public enum ChannelRuleEnum {
    /**
     * 巨量
     */
    OCEANENGINE("OCEANENGINE"),
    /**
     * 腾讯
     */
    TENCENT("TENCENT");

    public String code;

    public GeneralChannelRule channel;

    ChannelRuleEnum(String code, GeneralChannelRule channel) {
        this.code = code;
        this.channel = channel;
    }

    //匹配规则
    public static ChannelRuleEnum matchRule(String code){
        ChannelRuleEnum[] values = ChannelRuleEnum.values();
        for (ChannelRuleEnum value : values) {
            if(value.code.equals(code)){
                return value;
            }
        }
        return null;
    }

    ChannelRuleEnum(String code) {
        this.code = code;
    }
}